package com.itbaizhan;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class TestCheckedException02 {
    public static void main(String[] args) {
        FileReader reader=null; //声明
       try {
           FileReader read = new FileReader("d:/a.txt"); //这里定义的read 与上面声明要不同reader
           char c = (char) read.read();
           char c1 = (char) read.read();
           char c2 = (char) read.read();
           System.out.println(""+c+c1+c2);
       }catch (FileNotFoundException e) {
            e.printStackTrace();
       } catch (IOException e) {
           e.printStackTrace();
       }finally {  //关闭资源
           try {
               if(reader!=null){
                   reader.close();
               }
           }catch (IOException e){
               e.printStackTrace();
           }
       }
    }
}
